package cn.edu.ecut.threads;

/**
 * 1、通过创建 Thread 类 及其 子类类型的实例来创建 线程对象
 * 2、由main线程所创建的线程默认都与main线程在同一个线程组
 */
public class ThreadTest2 {

	public static void main(String[] args) {
		
		Thread first = new Thread(); // 创建线程实例
		System.out.println( first );
		System.out.println( "线程名称: " + first.getName() );
		System.out.println( "线程优先级: " + first.getPriority() );
		System.out.println( "线程组: " + first.getThreadGroup() );
		
		System.out.println( "- - - - - - - - - - - - - - - - - - - - - - - - - - -" );
		
		Thread second = new Thread() { // 创建子类类型的实例
		}; 
		System.out.println( second );
		System.out.println( "线程名称: " + second.getName() );
		System.out.println( "线程优先级: " + second.getPriority() );
		System.out.println( "线程组: " + second.getThreadGroup() );

	}

}
